/* Main include header for the SDL library */

#ifndef _SDL_H
#define _SDL_H

#define __inline__	
#define DECLSPEC	

#include <SDL/SDL_types.h>
#include <SDL/SDL_error.h>
#include <SDL/SDL_rwops.h>
#include <SDL/SDL_video.h>
#include <SDL/SDL_draw.h>

/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
extern "C" {
#endif

/* As of version 0.5, SDL is loaded dynamically into the application */

/* These are the flags which may be passed to SDL_Init() -- you should
   specify the subsystems which you will be using in your application.
*/
#define SDL_INIT_VIDEO			0x00000001
#define SDL_INIT_NOPARACHUTE	0x00100000	/* Don't catch fatal signals */

/* This function loads the SDL dynamically linked library and initializes 
 * the subsystems specified by 'flags' (and those satisfying dependencies)
 */
extern DECLSPEC int SDL_Init(Uint32 flags, void *user_data);

/* This function cleans up the initialized subsystems and unloads the
 * dynamically linked library.  You should call it upon all exit conditions.
 */
extern DECLSPEC void SDL_Quit(void);

/** @name The available application states */
/*@{*/
#define SDL_APPMOUSEFOCUS	0x01		/**< The app has mouse coverage */
#define SDL_APPINPUTFOCUS	0x02		/**< The app has input focus */
#define SDL_APPACTIVE		0x04		/**< The application is active */
/*@}*/

extern DECLSPEC Uint8 SDL_GetAppState(void);

/* Byte Order utility function */
#define SDL_LIL_ENDIAN	1234
#define SDL_BIG_ENDIAN	4321

#if defined(i386) || defined(WIN32) || defined(__alpha__) || defined(__arm__)
#define SDL_BYTEORDER	SDL_LIL_ENDIAN
#else
#define SDL_BYTEORDER	SDL_BIG_ENDIAN
#endif

/* Byteswap item from the specified endianness to the native endianness */
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
#define SDL_SwapLE16(X)	(X)
#define SDL_SwapLE32(X)	(X)
#define SDL_SwapLE64(X)	(X)
#define SDL_SwapBE16(X)	SDL_Swap16(X)
#define SDL_SwapBE32(X)	SDL_Swap32(X)
#define SDL_SwapBE64(X)	SDL_Swap64(X)
#else
#define SDL_SwapLE16(X)	SDL_Swap16(X)
#define SDL_SwapLE32(X)	SDL_Swap32(X)
#define SDL_SwapLE64(X)	SDL_Swap64(X)
#define SDL_SwapBE16(X)	(X)
#define SDL_SwapBE32(X)	(X)
#define SDL_SwapBE64(X)	(X)
#endif

extern DECLSPEC Uint16 SDL_Swap16(Uint16 D);
extern DECLSPEC Uint32 SDL_Swap32(Uint32 D);

/* Read an item of the specified endianness and return in native format */
extern DECLSPEC Uint16 SDL_ReadLE16(SDL_RWops *src);
extern DECLSPEC Uint16 SDL_ReadBE16(SDL_RWops *src);
extern DECLSPEC Uint32 SDL_ReadLE32(SDL_RWops *src);
extern DECLSPEC Uint32 SDL_ReadBE32(SDL_RWops *src);

/* Write an item of native format to the specified endianness */
extern DECLSPEC int SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
extern DECLSPEC int SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
extern DECLSPEC int SDL_WriteBE32(SDL_RWops *dst, Uint32 value);


#define SDL_malloc(size) malloc(size)
#define SDL_free(size) free(size)
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
};
#endif

#endif /* _SDL_H */
